package cz.schovjan.proj.entity;

import java.util.Collection;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "CONCERT", schema = "PPRO")
public class ConcertEntity {

	private int id;
	private String place;
	private Date dateTime;
	private String description;
	private Collection<BandEntity> bands;

	public ConcertEntity() {
	}

	public ConcertEntity(int id, String place, Date dateTime, String description) {
		this.id = id;
		this.place = place;
		this.dateTime = dateTime;
		this.description = description;
	}

	@Id
	@GeneratedValue
	@Column(name = "ID", unique = true, nullable = false)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "PLACE", length = 100)
	public String getPlace() {
		return place;
	}

	public void setPlace(String place) {
		this.place = place;
	}

	@Column(name = "DATE_TIME")
	public Date getDateTime() {
		return dateTime;
	}

	public void setDateTime(Date dateTime) {
		this.dateTime = dateTime;
	}

	@Column(name = "DESCRIPTION", length = 100)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@ManyToMany(mappedBy = "concerts")
	public Collection<BandEntity> getBands() {
		return bands;
	}

	public void setBands(Collection<BandEntity> bands) {
		this.bands = bands;
	}

	@Override
	public String toString() {
		return "Concert [id=" + id + ", place=" + place + ", dateTime="
				+ dateTime + ", description=" + description + "]";
	}
}
